package com.starmark.gateway.project.provider.command;


import com.starmark.gateway.project.provider.service.IGatewayProjectService;
import com.starmark.gateway.project.provider.service.IGatewayRouteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

/**
 * 网关工程初始化配置,
 * 后续会将其做为一个功能,做成类似多租户的功能
 *
 * @author starmark
 * @date 20-1-23  上午9:44
 */
@Component
public class GatewayProjectInitCommand implements CommandLineRunner {



    @Autowired
    @Lazy
    private IGatewayRouteService gatewayRouteService;

    @Autowired
    @Lazy
    private IGatewayProjectService gatewayAuthProjectService;

    @Override
    public void run(String... args) {

        gatewayAuthProjectService.overload();

        //重新加载路由

        gatewayRouteService.overload();


    }
}
